package january4;

import java.util.Scanner;

/**
 * ClassName: PerfectNumber
 * Package: january4
 * Description:求一定范围内的回文数
 *
 * @Author fjorid
 * @Create 2025/1/4 19:56
 * @Version 1.0
 */
public class PerfectNumber {
    public static void main(String[] args) {
        int lowerBound, previousBound;
        int sumFactors = 0;
        int n = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入所求范围的下届");
        lowerBound = scanner.nextInt();
        System.out.println("请输入所求范围的上届");
        previousBound = scanner.nextInt();
        for (int i = lowerBound; i <= previousBound; i++) {
            sumFactors = 0;
            for (int j = 1; j <= i - 1; j++) {
                if (i % j == 0) {
                    sumFactors += j;//求各个因子的和
                }

            }
            if (sumFactors == i) {
                System.out.print(sumFactors + " ");


            }
        }
    }
}
